package com.ruoyi.crm.controller;

import lombok.extern.slf4j.Slf4j;
import javax.annotation.Resource;
import com.ruoyi.crm.domain.vo.IndexParamsVO;
import com.ruoyi.crm.service.ReportDataService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mr.huang [jie88888822@163.com]
 * @devTime 2022-06-10
 */
@Slf4j
@RestController
@RequestMapping("/index")
public class IndexController {
	@Resource
	private ReportDataService reportDataService;

	@GetMapping
	public AjaxResult index(IndexParamsVO indexVO){
		log.info("beginCreateTime：{}",indexVO.getBeginCreateTime()
				,"\tendCreateTime：{}",indexVO.getEndCreateTime());
		return AjaxResult.success(reportDataService.getReportData(indexVO));
	}

	@GetMapping("/salesStatistic")
	public AjaxResult salesStatistic(IndexParamsVO indexParamsVO){
		return AjaxResult.success(reportDataService.salesStatistic(indexParamsVO));
	}

	@GetMapping("/businessChangeStatistics")
	public AjaxResult businessChangeStatistics(IndexParamsVO indexParamsVO){
		return AjaxResult.success(reportDataService.businessChangeStatistics(indexParamsVO));
	}
}
